<%@page import="com.bill.common.system.dto.RuleDTO"%>
<%@page import="com.bill.common.user.dto.RegisterUserQueryDTO"%>
<%@page import="com.bill.common.user.service.IRegisterUserService"%>
<%@page import="com.bill.common.user.dto.RegisterUserDTO"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="../language.jsp" %>
<%
if(session.getAttribute("password2")==null){
	response.sendRedirect( "login2.jsp?pageUrl=user/userUpgrade.jsp");
	return;
}
ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
IRegisterUserService registerUserService = (IRegisterUserService)ac.getBean("registerUserService");
RegisterUserQueryDTO qdto = new RegisterUserQueryDTO();
qdto.setLoginName((String)session.getAttribute("loginName"));
RegisterUserDTO registerUserDTO = registerUserService.findRegisterUserByIdOrLoginName(qdto);
request.setAttribute("registerUserDTO",registerUserDTO);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><fmt:message key="i18n.touzhiLevelUpdate"/>-<fmt:message key="i18n.title"/> </title>
<link rel="shortcut icon" href="../index/favicon.png" />
<link rel="stylesheet" type="text/css" href="css/style1.css">
<script type="text/javascript" src="../scripts/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../scripts/script.js"></script>
</head>
<body style="">
<div class="account">
	<div class="top2" style="background:#ffffed;">
	<a class="top2L" ><fmt:message key="i18n.userCenter"/> &gt; <fmt:message key="title.userUpgrade"/></a>
	<div class="top2R">&nbsp;</div>
	</div>
	<!-- <div class="left"></div> -->
	<c:if test="${registerUserDTO.registerLevel eq 'L4' or registerUserDTO.registerLevel eq 'L5' or registerUserDTO.registerLevel eq 'L6' }">
	<div class="cont" style="padding: 0;border-bottom: 0;">
		<div class="tx_Top" >
			<p>&nbsp;</p>
			<p><fmt:message key="i18n.alreadyHighestLevel" /></p>
			<p>&nbsp;</p>
		</div>
	</div>
	</c:if>
    <c:if test="${registerUserDTO.registerLevel ne 'L4' and registerUserDTO.registerLevel ne 'L5' and registerUserDTO.registerLevel ne 'L6'  }">
    <div class="cont">
		<form action="registerUser!userOpt.action" id="userUpgrade_form">
  		<input type="hidden" value="userUpgrade.jsp" name="pageUrl">
  		<input type="hidden" value="UserUpgrade" name="optType">
  		<input type="hidden" value="${session.loginName }" name="loginName">
	  	<c:if test="${registerUserDTO.registerLevel ne 'L5' }">
			<div class="tx_contBox">
				<p class="tx_contBoxL"><fmt:message key="i18n.userlevel" />：</p>
				<div class="tx_contBoxR">
					<div class="tx_contBoxR2"><div class="tx_contBoxRS"></div>
						<select class="tx_contBoxR2_1" id="registerLevel_reg1" name="upLevel">
   						<c:choose>  
						    <c:when test="${registerUserDTO.registerLevel=='L1'}">  
   							<option value="L2"><fmt:message key="L2" />(<%=RuleDTO.level.get("L2") %>)</option> 
						        </c:when>  
						    <c:when test="${registerUserDTO.registerLevel=='L2'}">  
   							<option value="L3"><fmt:message key="L3" />(<%=RuleDTO.level.get("L3") %>)</option> 
						    </c:when>  
						    <c:when test="${registerUserDTO.registerLevel=='L3'}">  
   							<option value="L4"><fmt:message key="L4" />(<%=RuleDTO.level.get("L4") %>)</option> 
						    </c:when>  
						    <c:when test="${registerUserDTO.registerLevel=='L4'}">  
   							<option value="L5"><fmt:message key="L5" />(<%=RuleDTO.level.get("L5") %>)</option> 
						    </c:when>  
						</c:choose>  
    					</select>
					</div>
				</div>
			</div>
			<div class="tx_contBox" style="border-bottom: 0;">
				<p class="tx_contBoxL">&nbsp;</p>
				<div class="tx_contBoxR">
					<c:if test="${not empty session.activationTime}">
	    			<c:if test="${registerUserDTO.registerLevel ne 'L5' }">
					<input class="tx_contBoxRAn" onclick="userUpgrade()" type="button" value="&nbsp;&nbsp;&nbsp;&nbsp;<fmt:message key="title.userUpgrade" />&nbsp;&nbsp;&nbsp;&nbsp;">
					</c:if>
   					</c:if>
				</div>
			</div>
	  	</c:if>
		</form>
    </div>
	</c:if>
</div>

<script type="text/javascript" src="../scripts/jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../scripts/user/reguser.js"></script>


<script type="text/javascript">

$(function(){
	document.onkeydown = function(evt){
		var evt = window.event?window.event:evt;
		if(evt.keyCode==13){
			userUpgrade();
		}
	}
});	
</script>

</body>
</html>